<template>
  <el-dialog :append-to-body="true" :visible.sync="dialog" title="拒收工单" width="600px">
    <div class="mb20 c-999" style="padding-left:20px;">注意：技术员拒收工单需要填写拒收原因</div>
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="60px">
      <el-form-item label="备注" prop="mark">
        <el-input placeholder="输入备注" type="textarea" v-model="form.mark" style="width: 460px;" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button size="small" :loading="loading" type="primary" @click="doSubmit">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { _ordersModify } from "@/http/ajax";
export default {
  name: "addnet",
  props: {
    cur_this: {
      type: Object,
      required: null
    }
  },
  data() {
    return {
      dialog: false,
      loading: false,
      form: {
        mark:"",
        id:""
      },
      rules: {
        mark: [{ required: true, message: "输入拒单原因", trigger: "blur" }]
      }
    };
  },

  methods: {
    domInit(id) {
        this.dialog = true;
        this.form.id = id;
        this.form.mark = "";
    },
    orderModify() {
      let data = {
        id: this.form.id,
        flowStatus: 3,
        status: 1,
        mark: this.form.mark
      }
      _ordersModify(data, res => {
        this.dialog = false;
        this.cur_this.getList();
      },err => {})
    },
    doSubmit() {
      this.$refs["form"].validate(valid => {
        if (valid) {
            this.orderModify()
        }
      });
    }
  }
};
</script>

<style lang="scss">
</style>
